package cn.edu.cug.cs.gtl.apps.ui.actions;

import cn.edu.cug.cs.gtl.apis.ui.AbstractApplication;
import org.pf4j.PluginManager;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class AppExitActionListener implements ActionListener {
    AbstractApplication theApp=null;
    public AppExitActionListener(AbstractApplication app){
        this.theApp=app;
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        PluginManager pluginManager = theApp.getPluginManager();
        if(pluginManager!=null)
            pluginManager.stopPlugins();
            pluginManager.unloadPlugins();
        System.exit(0);
    }
}
